<?php
class jumlah_beasiswa extends MY_Controller{
    function jumlah_beasiswa(){
        parent::MY_Controller();
        $this->data['title'] = "Administrasi Jumlah Beasiswa";
        $this->load->model('m_jumlah_beasiswa');
    }
    function index(){
        $this->data['content'] = "jumlah_beasiswa/v_jumlah_beasiswa";
        $this->data['listJumlahBeasiswa'] = $this->m_jumlah_beasiswa->getListJumlahBeasiswa();
        
        $this->render($this->data);
    }
    function edit_jumlah_beasiswa_form($id){
        $this->data['content'] = "jumlah_beasiswa/v_jumlah_beasiswa";
        $this->data['subLink'] = "jumlah_beasiswa/edit_jumlah_beasiswa_proses";
        $this->data['formTitle'] = "Form Edit Data Jumlah Beasiswa";
        $this->data['formView'] = "jumlah_beasiswa/editJumlahBeasiswaForm";
        $this->data['dataInput'] = $this->m_jumlah_beasiswa->getListJumlahBeasiswa($id);
        $this->data['listJumlahBeasiswa'] = $this->m_jumlah_beasiswa->getListJumlahBeasiswa();
        
        $this->render($this->data);
    }
    function edit_jumlah_beasiswa_proses(){
        $data = array('id' => $this->input->post('id'),
            'jumlah' => currencyToNumber($this->input->post('jumlah')));
        $update = $this->m_jumlah_beasiswa->editJumlahBeasiswa($data);
        if($update == TRUE){
            $this->session->set_flashdata("message",1);
        }else{
            $this->session->set_flashdata("message",2);
        }
        
        redirect("jumlah_beasiswa");
    }
}
?>
